package com.pingan.license.interceptor;


import com.pingan.license.model.LicenseCliModel;
import com.pingan.license.utils.LicenseVertify;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @AUTHOR:LIUCHAO;
 * @DATE: 2020/12/2 9:19
 */
@Component
public class LicenseCheck {

    @Autowired
    private LicenseVertify licenseVertify;

    @PostConstruct
    public void init() {
        licenseVertify.install(System.getProperty("user.dir"));
        if (!licenseVertify.verify()) {
            System.out.println("证书校验失败，服务启动失败");
            Runtime.getRuntime().halt(1);
        }
        System.out.println("证书校验成功");
    }
}